﻿namespace PugLib
{
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;

    public static class Factory
    {
        /// <summary>
        /// Adds repeatCount copies of value to a List
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        /// <param name="repeatCount"></param>
        /// <returns></returns>
        [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "factory method")]
        public static List<T> GenerateRepeatedList<T>(T value, int repeatCount)
        {
            return new List<T>(ParallelEnumerable.Repeat(value, repeatCount));
        }
    }
}